package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.MissingKeywordBook;
import com.pgybook.db.entity.domain.MissingKeywordBookEx;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

@Repository
public interface MissingKeywordBookMapper {
    int countByExample(MissingKeywordBookEx example);

    int deleteByExample(MissingKeywordBookEx example);

    @Delete({
            "delete from missingkeywordbook",
            "where MKWBID = #{mkwbid,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long mkwbid);

    @Insert({
            "insert into missingkeywordbook (CUSTTYPE, CUSTID, ",
            "CRTTIME, KEYWORD, ",
            "CUSTIP)",
            "values (#{custtype,jdbcType=INTEGER}, #{custid,jdbcType=BIGINT}, ",
            "#{crttime,jdbcType=TIMESTAMP}, #{keyword,jdbcType=VARCHAR}, ",
            "#{custip,jdbcType=VARCHAR})"
    })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "mkwbid", before = false, resultType = Long.class)
    int insert(MissingKeywordBook record);

    int insertSelective(MissingKeywordBook record);

    List<MissingKeywordBook> selectByExample(MissingKeywordBookEx example);

    @Select({
            "select",
            "MKWBID, CUSTTYPE, CUSTID, CRTTIME, KEYWORD, CUSTIP",
            "from missingkeywordbook",
            "where MKWBID = #{mkwbid,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    MissingKeywordBook selectByPrimaryKey(Long mkwbid);

    int updateByExampleSelective(@Param("record") MissingKeywordBook record, @Param("example") MissingKeywordBookEx example);

    int updateByExample(@Param("record") MissingKeywordBook record, @Param("example") MissingKeywordBookEx example);

    int updateByPrimaryKeySelective(MissingKeywordBook record);

    @Update({
            "update missingkeywordbook",
            "set CUSTTYPE = #{custtype,jdbcType=INTEGER},",
            "CUSTID = #{custid,jdbcType=BIGINT},",
            "CRTTIME = #{crttime,jdbcType=TIMESTAMP},",
            "KEYWORD = #{keyword,jdbcType=VARCHAR},",
            "CUSTIP = #{custip,jdbcType=VARCHAR}",
            "where MKWBID = #{mkwbid,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(MissingKeywordBook record);
}
